library(foreign)
library(ggplot2)
require(ggplot2)
library(ggrepel)
library(plyr)
require(scales)
require(gridExtra)
#Change this to your local directory#
setwd("/Users/ywang/Dropbox/Book Project on State Building/Princeton UP/Replication Package/Chapter 7/data/")
lineage <- read.dta("lineage cross section.dta")
attach(lineage)
plot1 <-ggplot(lineage, aes(x=jinshi_earlyqing_IHS, y=clans_IHS)) +
geom_point(shape=19, color="violetred4", size=3)+
geom_smooth(method=lm,  se=TRUE,linetype="solid",
color="deepskyblue4", fill="deepskyblue2")+
scale_y_continuous(name="N of Lineage Organizations (IHS)",limits=c(0,4), breaks=c(0,1,2,3,4))+
scale_x_continuous(name="N of Advanced Scholars (IHS)", limits=c(0,7), breaks=c(0,1,2,3,4,5,6,7))+
theme(text = element_text(size=18,
vjust=1, family="Times"))+
theme_bw()
plot2 <-ggplot(lineage, aes(x=conflicts_earlyqing_IHS, y=clans_IHS)) +
geom_point(shape=19, color="violetred4", size=3)+
geom_smooth(method=lm,  se=TRUE,linetype="solid",
color="deepskyblue4", fill="deepskyblue2")+
scale_y_continuous(name="N of Lineage Organizations (IHS)",limits=c(0,4), breaks=c(0,1,2,3,4))+
scale_x_continuous(name="N of Conflicts (IHS)", limits=c(0,2.5), breaks=c(0,0.5,1,1.5,2,2.5))+
theme(text = element_text(size=18,
vjust=1, family="Times"))+
theme_bw()
grid.arrange(plot1, plot2, ncol=2)
